Skip to content

Added Feature: File size base log rotation #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ChrisHubinger
Copy link

@ChrisHubinger ChrisHubinger commented Feb 18, 2020

File size based log rotation

Motivation

In one of our Projects we need to implement log rotation to make sure the disk does not fill up.
As it seems not easily possible to simply use logrotate for that purpouse without the risk loosing events I've implemented a file size based rotation directly in this plugin.

Feature already in discussion here: #57

Configuration

Rotation is enabled by setting the parameter file_rotation_size to a value > 0 (Default: 0) and otional set the parameter max_file_rotation to a non negative value to limit the number of created log files.
keep_file_extension => true, will prepend the rotation index before the file extension of the output path. Creating files like /path/to/logs/app.0.log /path/to/logs/app.1.log /path/to/logs/app.2.log ...

Implementation notes

The current file size is only checked when rotation is enabled.
The cleanup/housekeeping deletes only the last created file when limit has been reached e.g does not scvann folder for further files that may be deleted.

Tests

I added tests to validate the implementation, in a very similar way other features are tested

I'd be very happy to see this feature merged into upstream so that with future releases we do not need to ship our own version of the plugin anymore.
Please give me feedback if there is anything further i can do to get this PR accepted.

Thanks to you all for all the work on this great product.

Kind Regards,
Christian

@ChrisHubinger
Copy link
Author

ChrisHubinger commented Feb 18, 2020

As I see from the Travic CI errors something in the test setup seeems to have changed from version 5 => 6,7.. as it complains about missing insist method.

I failed with wrapping agent do ... end inside it 'test case' do .. end block so that i can use expect instead.

Any hint for me how i can fix that?

@ChrisHubinger
Copy link
Author

ChrisHubinger commented Apr 2, 2020

@ph @jsvd
Is there anything I can do to get feedback to this PR?

@oxyrox
Copy link

oxyrox commented Oct 8, 2020

Are there any plans to get this reviewed?

@ChrisHubinger meanwhile the version has changed to 4.3.0 so you could already rebase and update the version. Hopefully there will be some momentum on this.

We could really use this feature, nice work btw!

@taylorjdlee
Copy link

This would be fantastic to add like honestly this feature has been talked about for 7 years but never merged..... a lot of us would like it!

@taylorjdlee
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants